//
//  ViewController.m
//  5-24
//
//  Created by 李尹卓 on 16/5/24.
//  Copyright © 2016年 lyz. All rights reserved.
//

#import "ViewController.h"
#import "HTableViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    self.title = @"朕的江山😎";
    self.view.backgroundColor = [UIColor grayColor];
    self.view.backgroundColor = [UIColor whiteColor];
    self.refreshControl = [UIRefreshControl new];
    self.refreshControl.tintColor = [UIColor darkGrayColor];
    self.refreshControl.attributedTitle = [[NSAttributedString alloc]initWithString:@"😟看我七十二变👅" attributes:@{NSForegroundColorAttributeName:[UIColor darkGrayColor]}];
//    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"🤔" style:UIBarButtonItemStylePlain target:self action:@selector(onClick:)];
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"1"] style:UIBarButtonItemStylePlain target:self action:@selector(onClick:)];
    
    
    UIImageView *iv = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"2"]];
    self.navigationItem.titleView =iv;
   
}
-(void)onClick:(id)sender
{
    [self.refreshControl endRefreshing];

}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 8;

}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:( NSIndexPath *)indexPath
{
    UITableViewCell *cell =[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:nil];
    NSString *imgName = [NSString stringWithFormat:@"%ld",indexPath.row + 1];
    cell.imageView.image = [UIImage imageNamed:imgName];
    cell.imageView.layer.cornerRadius =18;
    
    cell.textLabel.text = @"朕";
//   if (cell.textLabel.accessibilityLabel == 0)
//   {
//       cell.textLabel.text = @"aahaha";
//   }
//    if (cell.textLabel.accessibilityLabel == 1) {
//        cell.textLabel.text = @"jheheh";
//    }
    
        
    
    cell.detailTextLabel.text = @"都是朕的";

    cell.accessoryType =UITableViewCellAccessoryDisclosureIndicator;
    return cell;
}



- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(nonnull NSIndexPath *)indexPath
{

//    ViewController * con = [ViewController new];
    HTableViewController *con = [HTableViewController new];
    [self.navigationController pushViewController:con animated:YES];

}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.




}

@end
